package com.smart.parking.controller.backstage;

import java.util.Arrays;
import java.util.Map;

import com.smart.parking.config.Result;
import com.smart.parking.entity.ViolationEntity;
import com.smart.parking.service.ViolationService;
import com.smart.parking.utils.PageUtils;
import com.smart.parking.vo.NoticeVO;
import com.smart.parking.vo.ViolationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 违规停车信息表
 *
 * @author ciyun
 */
@RestController
@RequestMapping("/violation")
public class ViolationController {
    @Autowired
    private ViolationService violationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtils page = violationService.queryPage(params);

        return Result.ok().put("page", page);
    }

    /**
     * 添加违规记录
     *
     * @param violationVO 违反签证官
     * @return {@link Result}
     */
    @PostMapping("/addViolation")
    public Result addViolation(@RequestBody ViolationVO violationVO){
        violationService.addViolation(violationVO);
        return Result.ok();
    }

    /**
     * 添加一条公告
     *
     * @param noticeVO 请注意签证官
     * @return {@link Result}
     */
    @PostMapping("/addNotice")
    public Result addNotice(@RequestBody NoticeVO noticeVO){
        violationService.addNotice(noticeVO);
        return Result.ok();
    }

}
